<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ page language="java" import="java.util.*"
	contentType="text/html;charset=UTF-8"%>
<%@ include file="/common/taglib.jsp"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
		<meta http-equiv="Content-Language" content="zh-cn">
		<title></title>
		<link rel="stylesheet" type="text/css" href="<%=basePath%>css/style.css">
		<link id="editCss" rel="stylesheet" type="text/css" href="<%=basePath%>css/style.css" />
		<link id="editCss" rel="stylesheet" type="text/css" href="<%=basePath%>css/right.css" />
		<script type="text/javascript" src="<%=basePath%>js/base.js"></script>
		<script type="text/javascript" src="<%=basePath%>js/crawler.js" ></script>
		<script type="text/javascript" src="<%=basePath%>js/popUpBase.js"></script>
	</head>
	<body>
		<div class="crumbs">当前位置：站点管理</div>
		<div class="search">
			<div class="tab" >
				<span class="right"></span>
				<span class="font-blue14pxb">站点管理</span>
		    </div>
		</div>
<form method="post">
<div class="search">
	<ul class="con minHeight">
		<li style="width:auto;">
			<input type="button" name="addStation" id="addStation" value="添加站点"
				class="button" style="margin-left: 5px"
			 	onclick="openWin('<%=basePath%>crawler/addWebsite.jsp','add',350,100)" />
		</li>
	</ul>
</div>
<div class="tableBox">
	<input type="hidden" name="hiddenId" id="hiddenId" />
	<table cellPadding="0" cellSpacing="0" border="0" width="100%"
		id="tableList"
		style="border-collapse: collapse; empty-cells: show;">
		<tr>
			<th>序号</th>
			<th>名称</th>
			<th>关键字</th>
			<th>操作</th>
			<th></th>
		</tr>
		<c:forEach items="${websiteList}" var="site" varStatus="index">
			<tr><td >${index.count }</td>
				<td >${site.title}</td>
				<td >${site.keywords}</td>
				<td>
					
					<img src="<%=path %>/images/icon/list_edit.gif" style="margin-bottom: 1px"  />
					
					<input type="button" name="updateStation" id="updateStation" value="修改"
						class="button" style="margin-left: 5px"
					 	onclick="openWin('<%=basePath%>crawler/WebsiteAction?method=update&id=111','update',350,100)" />	
				<!--|<a href="javascript:void(0);" 
						onclick="javascript:showAddDialog(this.parentNode.parentNode)" >
						<span style="margin-bottom: 1px">修改</span>
					</a>
					 <img src="<%=path %>/images/icon/list_del.gif" style="margin-bottom: 1px"/>
					<a href="javascript:void(0);"
						onclick="deleteData('${role["ROLE_ID"]},'${role["ROLE_NAME"]}');" >
						<span style="margin-bottom: 1px">删除</span>
					</a> -->
				</td>
				<td><a href="http://${site.path}" target="new">点我直接访问</a></td>
			</tr>
		</c:forEach>
	</table>
</div>
<%@include file="/jsp/pagination.jsp"%>
</form>
</body>
	<script type="text/javascript">
		function showAddDialog(parent){
			var url ='<%=basePath%>crawler/add.jsp' ;
			if(arguments.length > 0){
				 var tds =	parent.cells ;
				 url +='?path='+trim(tds[4].innerHTML)+"　"+'&title='+trim(tds[2].innerHTML)+'&keywords='+trim(tds[3].innerHTML)+'' ;
			}
			top.popUp('website_add', '添加站点',url, 400, 208,function() {});
		}
		  
		function deleteData(id,name){
			document.getElementById("hiddenId").value = id ;
			if(window.confirm("确定要删除名称为 "+name+" 这条数据么?")){
				document.forms[0].action="<%=basePath%>servlet/role?action=deleteData";
				document.forms[0].submit();
			}
		}
		
		function showPermission(id){
			popUp('role_view', '查看角色权限',"<%=basePath%>rpv?roleId="+id, 400, 330,function() {});
		}
		
		function trim(v){
			return (v==null || v==undefined)?"":v.replace(/^\s*/, "").replace(/\s*$/,""); 
		}
	</script>
		<script type="text/javascript">
		window.onload=function(){
			initPageWH();
		}
		
		window.onresize = function(){
			initPageWH();	//浏览器大小改变时重新获取宽高
		}
		
		/*层高*/
		var z_Index=100;
		/*调用函数*/
		function popUp(id,title,url,width,height,callBack,content){
			z_Index+=2;
			var conHeight=height-20;
			if(url){
				var con='<iframe id="'+id+'_iframe" src="'+url+'" scrolling="auto" frameborder="no" border="0" marginwidth="0" marginheight="0" scrolling="no" class="conIframe" style="height:'+conHeight+'px;"></iframe>';
			}else{
				var con=content;
			}
			popUpAdapter(id,{title:title,con:con,width:width,height:height,conHeight:conHeight,css:'popUpCss',bgCss:'popUpBgCss',zIndex:z_Index},callBack)
		}
		
	</script>
</html>